import 'package:flutter/material.dart' as prefix0;
import 'package:html/dom.dart';

import '../HtmlContent.dart';
import '../TransformUnit.dart';

class TagH extends TransformUnit<HtmlContentState, Object> {
	var tags = [
		"h1",
		"h2",
		"h3",
		"h4",
		"h5",
		"h6",
	];
	@override
	void execution(context, data) {
		if (data is Element && tags.contains(data.localName)){
			var fontSize = 12.0;
			switch (data.localName){
				case "h6": fontSize = 12; break;
				case "h5": fontSize = 14; break;
				case "h4": fontSize = 17; break;
				case "h3": fontSize = 20; break;
				case "h2": fontSize = 23; break;
				case "h1": fontSize = 26; break;
			}

			var content = data.text;
			pipeLineContext.processWith(prefix0.Text(content, style: prefix0.TextStyle(fontSize: fontSize, fontWeight: prefix0.FontWeight.bold),));
		}
	}
}
